package exercise5;

import java.util.ArrayList;
import java.util.Scanner;

public class Exercise11_14 {
    public static void main(String []args){
        ArrayList<Integer> list1=new ArrayList<>();
        ArrayList<Integer> list2=new ArrayList<>();
        Scanner input=new Scanner(System.in);
        System.out.println("请输入第一个数组：");
        for (int i=0;i<5;i++){
            list1.add(input.nextInt());
        }
        System.out.println("请输入第二个数组：");
        for (int i=0;i<5;i++){
            list2.add(input.nextInt());
        }

        ArrayList<Integer> list3=union(list1,list2);
        for (int i=0;i<10;i++){
            System.out.print(list3.get(i));
            System.out.print(" ");
        }


    }
    public static ArrayList<Integer> union(ArrayList<Integer> list1, ArrayList<Integer> list2){
        ArrayList<Integer> res=new ArrayList<>();
        for (int i=0;i<5;i++){
            res.add(list1.get(i));
            res.add(list2.get(i));
        }
        return res;
    }
}

